import Vue from 'vue'
import VueRouter from "vue-router";
import Home from '../views/Home'
import Login from "../components/Login";
import UserManagement from '../components/user/UserManagement.vue'
import Welcome from '../components/Welcome'
import OptimizeSchemeManagement from '../components/computingtask/OptimizeShemeManagement'
import ContainerSchemeManagement from '../components/computingtask/ContainerSchemeManagement'
import CalculationCreation from '../components/computingtask/CalculationCreation'
import CalculateProgress from '../components/computingtask/CalculateProgress'
import CalculationSchemeManagement from '../components/computingtask/CalculationSchemeManagement'
import OptimizationComparison from '../components/computingtask/OptimizationComparison'
import Load from '../components/docker/Load'
import ContainerCreation from '../components/docker/ContainerCreation'
import Image from '../components/docker/ImageCreation'
import CalculationManagement from '../components/computingtask/CalculateManagement'
import BasicRescoures from'../components/platformmanagement/BasicResources'
import ContainerClusterCreation from "@/components/docker/ContainerClusterCreate"
import Test from '../components/user/test'
import Course from '../components/test/courseCreation'

Vue.use(VueRouter)
const routes = [
    {
        path: '/',
        //重定向
        // redirect:'/login',
        redirect:'/test',

    },
    {
        path: '/login',
        name: 'Login',
        component: Login
    },
    {
        path: '/home',
        name: 'Home',
        redirect: '/welcome',
        component: Home,
        children:[{
            path: '/welcome',
            name:'Welcome',
            component: Welcome
        },
            {
                path: '/usermanagement',
                name: 'UserManagement',
                component:UserManagement
            },
            {
                path: '/BasicResources',
                name: 'BasicResources',
                component:BasicRescoures
            },
            {
                path: '/optimizeschememanagement',
                name: 'optimizeschememanagement',
                component: OptimizeSchemeManagement
            },
            {
                path: '/calculationmanagement',
                name:'calculationmanagement',
                component: CalculationManagement
            },
            {
                path:'/containerschememanagement',
                name:'containerschememanagement',
                component: ContainerSchemeManagement
            },
            {
                path: '/image',
                name: 'Image',
                component:Image
            },
            {
                path: '/load',
                name: 'load',
                component:Load
            },
            {
                path: '/containercreation',
                name: 'ContainerCreation',
                component:ContainerCreation
            },
            {
                path: '/optimizationcomparison',
                name: 'OptimizationComparison',
                component:OptimizationComparison
            },
            {
                path: '/calculationcreation',
                name: 'CalculationCreation',
                component:CalculationCreation
            },
            {
                path: '/calculateprogress',
                name: 'CalculateProgress',
                component:CalculateProgress
            },
            {
                path: '/calculationschememanagement',
                name: 'CalculationSchemeManagement',
                component:CalculationSchemeManagement
            },
            {
                path: '/containerClusterCreation',
                name: 'containerClusterCreation',
                component:ContainerClusterCreation
            },
            {
                path:'/test',
                name:'test',
                component: Test
            },
            {
                path:'/course',
                name:'course',
                component: Course
            },

        ]

    }


]
const router = new VueRouter({

    mode:'history',
    routes
})
//挂载路由导航守卫
// router.beforeEach((to,from,next) =>{
//     if(to.path == '/login'){
//         next()
//     }else{
//         const token = window.sessionStorage.getItem('token');
//         if(!token){
//             next('/login')
//         }else{
//             next()
//         }
//
//
//     }
// })

export default router
